package com.xiu.json.util;

import java.io.*;

/**
 * @Author: tjc
 * @description
 * @Date Created in 21:17 2022-04-02
 */
public class StringLoader {
    public static String load(String filename) {
        StringBuilder builder = new StringBuilder();
        String filePath = StringLoader.class.getClassLoader().getResource(filename).getFile();
        File file = new File(filePath);
        byte[] buf = new byte[(int) file.length()];
        try {
            InputStream input = new FileInputStream(file);
            input.read(buf);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return new String(buf);
    }

    public static void main(String[] args) {
        System.out.println(StringLoader.load("1.csv"));;
    }
}
